//
//  GoodsCell.m
//  MyDemo2
//
//  Created by ZSMAC on 2018/10/8.
//  Copyright © 2018年 张帅. All rights reserved.
//

#import "GoodsCell.h"
@interface GoodsCell  ()
@property(nonatomic,strong)UIImageView * showImageView;//封面
@property(nonatomic,strong)UILabel * titleLabel;//标题
@property(nonatomic,strong)UILabel * priceLabel;//单价

@end
@implementation GoodsCell
- (instancetype)initWithFrame:(CGRect)frame {
    self=[super initWithFrame:frame];
    if (self) {
        [self uiConfigure];
    }
    return self;
}
- (void)uiConfigure {
    self.layer.cornerRadius=8;
    self.layer.masksToBounds=YES;
    self.backgroundColor= [UIColor whiteColor];
    
    _showImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height/2+50)];
    _showImageView.backgroundColor=[UIColor whiteColor];
    [self addSubview:_showImageView];
    
     _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,_showImageView.bottom+5 , self.width-10, 35)];
    _titleLabel.font=[UIFont systemFontOfSize:13];
    _titleLabel.numberOfLines=0;
    [self addSubview:_titleLabel];
    
    
    _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,_titleLabel.bottom+5 , self.width-10, 30)];
    _priceLabel.font=[UIFont boldSystemFontOfSize:16];
    _priceLabel.textColor=[UIColor redColor];
    [self addSubview:_priceLabel];
    
    
}
- (void)setModel:(GoodsModel *)model {
    _model=model;
    [_showImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImageUrl]];
    _titleLabel.text=_model.title;
    _priceLabel.text=[NSString stringWithFormat:@"￥%@",_model.UnitPrice];
}








@end
